package fr.umlv.m2.jee.portailEtudiant.web.action.course;

import com.opensymphony.xwork2.ActionSupport;
import fr.umlv.m2.jee.portailEtudiant.service.*;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: soufiane
 * Date: 17/04/11
 * Time: 14:42
 * To change this template use File | Settings | File Templates.
 */
public class Courses extends ActionSupport {

    @Autowired
    private IDisplayCourseService courseService;
    private String name;
    private List<DisplayCourse> courseList;
    private List<DisplayTutorial> tutoList;
    private List<DisplayTd> tdList;
    private List<DisplayTp> tpList;
    private List<DisplayCourseDocument> documentList;

    @Override
	public String execute() throws Exception {
        System.out.println("ds execute 1");
		courseList = courseService.getAllDisplayCourses();
        System.out.println("ds execute 2");
		return SUCCESS;

	}

    public String listTds() throws Exception {
        System.out.println("ds execute 1");
        System.out.println(getName());
		tdList = courseService.getAllTdsById(getName());
        System.out.println("ds execute 2");
		return SUCCESS;

	}

    public String listTps() throws Exception {
        System.out.println("ds execute 1");
        System.out.println(getName());
		tpList = courseService.getAllTpsById(getName());
        System.out.println("ds execute 2");
		return SUCCESS;

	}

    public String listTutos() throws Exception {
        System.out.println("ds execute 1");
        System.out.println(getName());
		tutoList = courseService.getAllTutorialsById(getName());
        System.out.println("ds execute 2");
		return SUCCESS;

	}

    public String listDocument() throws Exception {
        System.out.println("ds execute 1");
        System.out.println(getName());
		documentList = courseService.getAllDocumentById(getName());
        System.out.println("ds execute 2");
		return SUCCESS;

	}


    public IDisplayCourseService getCourseService() {
        return courseService;
    }

    public List<DisplayCourse> getCourseList() {
        return courseList;
    }

    public List<DisplayTutorial> getTutoList() {
        return tutoList;
    }

    public List<DisplayTd> getTdList() {
        return tdList;
    }

    public List<DisplayTp> getTpList() {
        return tpList;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<DisplayCourseDocument> getDocumentList() {
        return documentList;
    }
}
